﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DCTLib.Common;
using System.Data;

namespace DCTAccess.Business.Testing
{
    public class Testing
    {
        private int _id = -1;

        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }
        private string _memberName = string.Empty;

        public string MemberName
        {
            get { return _memberName; }
            set { _memberName = value; }
        }
        private decimal _pointNumber = 0;

        public decimal PointNumber
        {
            get { return _pointNumber; }
            set { _pointNumber = value; }
        }

        public Testing() { }

        public Testing(int id, string username, decimal point)
        {
            this.Id = id;
            this.MemberName = username;
            this.PointNumber = point;
        }

        public static DataTable GetAllPointValue()
        {
            SQLHelper sqlHelper = new SQLHelper();
            string sProc = "Testing_spr";
            DataTable dtReport = sqlHelper.GetDataTable(sProc);
            if (ValidationHelper.HasRow(dtReport))
            {
                return dtReport;
            }
            else
            {
                return null;
            }
        }

        public static bool ResetData(int point)
        {
            SQLHelper sqlHelper = new SQLHelper();
            string sProc = "TestingReset_spr";
            sqlHelper.AddParameter("@Point", point);
            return sqlHelper.ExecuteSQL(sProc);
        }
    }
}
